package com.sushi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sushi.bean.User;
import com.sushi.dao.UserDao;
import com.sushi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public Page<User> findAll() {
        Page<User> all = userDao.selectPage(new Page<User>(1L, 1L), null);
        System.out.println("当前：" + all.getCurrent());
        System.out.println("总页数：" + all.getPages());
        System.out.println("页大小：" + all.getSize());
        System.out.println("总数据数：" + all.getTotal());
        System.out.println("数据：" + all.getRecords());
        return all;
    }

    @Override
    public Page<User> findByValues(Page<User> page, LambdaQueryWrapper<User> wrapper) {
        return userDao.selectPage(page, wrapper);
    }

//    @Override
//    public List<User> findAll() {
////        return userDao.findAll();
//        return userDao.selectList(null);
//    }

}
